<template>
	<view class="setPadding">
				<navigationBar :titleName="'交易记录'"></navigationBar>
		<zero-loading v-if="loading" type="love" :mask="true"></zero-loading>
			<view style="padding-top: 20rpx;" class="setMarginVertical setBgfff setRadius recordBox" v-for="(item,index) in record" :key="index">
				<view v-if="item.tradeNo" class="setfontSize2 setFontColor1 " >
					订单号：{{item.tradeNo}}
				</view>
				<view class="sethorizontalbetween setVerticalCenter">
					<view class="setVerticalCenter">
						<view class="setVerticalCenter" v-if="item.payType=='weixinPay'">
							<u-icon name="weixin-circle-fill" color="#3dd014" size="50"></u-icon>微信支付
						</view>
						<view class="setVerticalCenter"  v-else>
							<u-icon name="zhifubao-circle-fill" color="#2979ff" size="50"></u-icon>支付宝支付
						</view>
						<view class="setVerticalCenter" v-if="item.status==10">
							:支付状态<uni-icons type="closeempty" color="#d0361b" size="15"></uni-icons>
						</view>
						<view class="setVerticalCenter"  v-else-if="item.status==20">
							：支付完成<uni-icons type="checkmarkempty" color="#3dd014" size="15"></uni-icons>
						</view>
					</view>
					<view class="setFont"> <text class="setFont">￥</text>{{item.payMoney/100}}</view>
				</view>
				
				<view class="setfontSize2 setFontColor1" >
					{{$u.timeFormat(item.timestamp, 'yyyy年mm月dd日 hh时MM分ss秒')}}
				</view>
			</view>
			<view v-if="length==0" class="">
			
				<noData  text="暂无相关信息~"></noData> 
			</view>
	</view>
</template>

<script>
	export default {

		data() {
			return {
				// 加载提示
				loading: false,
				// 记录消费记录
				record:null,
				length:1
			}
		},
		beforeMount() {
			// 查找交易记录
			this.getfindPayLog()
		},
		// 下拉刷新
		onPullDownRefresh() {
			this.loading = true
			setTimeout(() => {
				this.getfindPayLog()
				uni.stopPullDownRefresh();
				this.loading = false
			}, 2000);
		},
		methods:{
			getfindPayLog(){
				
				this.$app.request({
					url: this.$baseApp.api.pay.findPayLog,
					
					method: 'POST',
					dataType: 'json',
					success: res => {
						console.log("这里是支付",res)
						this.record=[]
						if(res.code==200){
							if(res.data.length>0){
								res.data.forEach(item=>{
									this.record.push(item)
									
								})
							}else{
								
								this.length=0
							}
							
						}
					},
					complete: res => {
					
					}
				});
			}
		}
	}
</script>

<style>
	.recordBox{
		padding: 0 20rpx 20rpx 20rpx;
		box-sizing: border-box;
	}
</style>
